'use strict';

const Controller = require('egg').Controller;

class Ceshi_yscController extends Controller {
  async index() {
    //用户名称表
    // await this.app.model.Cruxname.create({name:'弋世成'});
    // await this.app.model.Cruxname.create({name:'贾海港'});
    //角色名称
    await this.app.model.Rolename.create({ name: '超级管理' });
    await this.app.model.Rolename.create({ name: '管理员' });
    await this.app.model.Rolename.create({ name: '班主任' });
    //权限详情
    await this.app.model.Roledetails.create({ type: '项目管理', roled: '项目列表' });
    await this.app.model.Roledetails.create({ type: '项目管理', roled: '班级管理' });
    await this.app.model.Roledetails.create({ type: '学生管理', roled: '学生查询' });
    //权限名对应权限详情
    await this.app.model.Menu.create({ rolename_name: '超级管理', roledetails_roled: '学生查询' });
    await this.app.model.Menu.create({ rolename_name: '超级管理', roledetails_roled: '班级管理' });
    await this.app.model.Menu.create({ rolename_name: '超级管理', roledetails_roled: '项目列表' });
    await this.app.model.Menu.create({ rolename_name: '班主任', roledetails_roled: '班级管理' });
    //项目表
    await this.app.model.Project.create({ name: '青龙职教中心', project_site: '青龙', project_sketch: '挺牛逼的项目', project_state: '有效' });
    await this.app.model.Project.create({ name: '山海关铁路技师学院', project_site: '山海关', project_sketch: '挺牛逼的项目', project_state: '有效' });
    await this.app.model.Project.create({ name: '弋世成牛逼', project_site: '四川', project_sketch: '挺牛逼的项目', project_state: '有效' });
    //用户信息
    await this.app.model.User.create({
      username: 'root',
      password: 'e10adc3949ba59abbe56e057f20f883e',
      sex: '男', email: '3427141688@qq.com',
      phone: 16608246529, state: '有效', project_name: '弋世成牛逼',
      rolename_name: '超级管理', name: '弋世成'
    });
    await this.app.model.User.create({
      username: 'roots',
      password: 'e10adc3949ba59abbe56e057f20f883e',
      sex: '男', email: '3427141687@qq.com',
      phone: 16608246528, state: '有效', project_name: '山海关铁路技师学院',
      rolename_name: '超级管理', name: '贾海港'
    });
    //班级表
    await this.app.model.Class.create({ name: '计算机5班', project_name: '山海关铁路技师学院', user_name: '弋世成', state: '有效' });
    // await this.app.model.Class.create({name:'计算机6班',project_name:'山海关铁路技师学院',user_name:'贾海港',state:'有效'});
    await this.app.model.Class.create({ name: '计算机7班', project_name: '山海关铁路技师学院', user_name: '弋世成', state: '有效' });
    await this.app.model.Class.create({ name: '计算机6班', project_name: '青龙职教中心', user_name: '贾海港', state: '有效' });
    await this.app.model.Class.create({ name: '计算机4班', project_name: '青龙职教中心', user_name: '贾海港', state: '有效' });
    //用户班级表+
    await this.app.model.Userclass.create({ class_name: '计算机4班', user_name: '贾海港' });
    await this.app.model.Userclass.create({ class_name: '计算机4班', user_name: '弋世成' });
    await this.app.model.Userclass.create({ class_name: '计算机6班', user_name: '贾海港' });
    await this.app.model.Userclass.create({ class_name: '计算机6班', user_name: '弋世成' });
    await this.app.model.Userclass.create({ class_name: '计算机7班', user_name: '弋世成' });
    //学生表
    await this.app.model.Student.create({name: '王志峰', number: '10086',sex: '男', class_name: '计算机5班',phone: '1212121212121',address: '河北秦皇岛',idcard: '4461654235623652365',project_name: '山海关铁路技师学院',state: '有效',thousand: '0',award: '一个没有',work: '啥几把玩意',score_grouping: '傻逼王志峰'});
    await this.app.model.Student.create({name: '王志海', number: '45354',sex: '男', class_name: '计算机4班',phone: '865868752758665',address: '河北秦皇岛',idcard: '8653869535286532',project_name: '弋世成牛逼',state: '有效',thousand: '0',award: '一个没有',work: '啥几把玩意',score_grouping: '傻逼王志峰'});
    await this.app.model.Student.create({name: '欧克欧克', number: '453521',sex: '男', class_name: '计算机6班',phone: '7853687532',address: '河北秦皇岛',idcard: '845638563564362',project_name: '弋世成牛逼',state: '有效',thousand: '0',award: '一个没有',work: '啥几把玩意',score_grouping: '傻逼王志峰'});
    await this.app.model.Student.create({name: '暗室逢灯', number: '453245',sex: '男', class_name: '计算机7班',phone: '6935668953268',address: '河北秦皇岛',idcard: '785325642375823',project_name: '青龙职教中心',state: '有效',thousand: '0',award: '一个没有',work: '啥几把玩意',score_grouping: '傻逼王志峰'});
    this.ctx.body = 12
  }
}

module.exports = Ceshi_yscController;
